import { extend } from "umi-request";

const getToken = () => {
  return sessionStorage.getItem("token") || "";
};

const request = extend({
  prefix: "/api",
  timeout: 20000,
  headers: {
    "Content-Type": "appcation/json",
    token: getToken(),
  },
  errorHandler(err) {
    console.log(err);
  },
});

/* request.interceptors.request.use((url, options) => {
  return {
      url: url,
      options: options
    }
})
request.interceptors.response.use((response, options) => {
  return response
}) */
export default request;
